<!DOCTYPE html>
<html lang="en">
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>


    <script th:src="@{/js/mui.min.js}"></script>
    <link rel="stylesheet" th:href="@{/css/mui.css}">
    <script th:src="@{/js/jquery-1.8.2.min.js}"></script>
    <script type="text/javascript">

        var data  =localStorage.getItem("loginuser");
        var loginUser = JSON.parse(data);
        if (loginUser==null){
            window.location.href="/user/login";
        }

        $(document).ready(function(){
            ecd();
        });

        function ecd(){

            var json={id:loginUser.id};
            $.ajax({
                "async":true,
                url: "/page/showme",
                dataType:'json',
                contentType:"application/json",
                data:json,
                success: function(data){

                    console.log(data.status);
                    if (data.status==200) {


                        var num = data.data.length;
                        var str="";
                        for (var i = 0; i < num; i++) {
                          //  str+= "<li  id='store' userid='"+data.data[i].userid+"' style='background-color: white;border: 1px solid burlywood;width: 100%;height: 30px;text-align: center;margin-top: 10px;'>" + data.data[i].name + "</li>";
                                if (data.data[i].flag==0){
                            str+="<tr><td class=\"mui-table-view\" style='text-align: center;font-size: 13px;height:80px; text-align: center; '>" + data.data[i].userid +"</td>" +
                                "<td class=\"mui-table-view\" style='font-size: 12px;height:80px; text-align: center;' >" + data.data[i].name + "</td>" +
                                "<td class=\"mui-table-view\" style='font-size: 12px;height:80px; text-align: center; color: #6d6d72' >" + "未审核"+ "</td>" +
                                "<td class=\"mui-table-view\" style='font-size: 12px;height:80px;text-align: center;'>"+ data.data[i].seat +"</td>" +
                                "<td class=\"mui-table-view\" style='height:80px;' >"+"<button id='store' userid='"+data.data[i].userid+"' class=\"mui-btn mui-btn-primary\">查看</button>" +"</td>" +
                                "</tr>";
                                }else {
                                    str+="<tr><td class=\"mui-table-view\" style='text-align: center;font-size: 13px;height:80px; text-align: center; '>" + data.data[i].userid +"</td>" +
                                        "<td class=\"mui-table-view\" style='font-size: 12px;height:80px; text-align: center;' >" + data.data[i].name + "</td>" +
                                        "<td class=\"mui-table-view\" style='font-size: 12px;height:80px; text-align: center; color: #4cd964' >" + "通过"+ "</td>" +
                                        "<td class=\"mui-table-view\" style='font-size: 12px;height:80px; text-align: center;'>"+ data.data[i].seat +"</td>" +
                                        "<td class=\"mui-table-view\" style='height:80px;'>"+"<button id='store' userid='"+data.data[i].userid+"' class=\"mui-btn mui-btn-primary\">查看</button>" +"</td>" +
                                        "</tr>";
                                }

                            $("#conter").html(str);
                        }
                    }
                },
                error : function() {
                    console.error("获取后端数据失败!");
                }

            });

        }
    </script>
    <script type="text/javascript" charset="utf-8">
        mui.init();
    </script>



</head>
<body>
    <div style="background-color: white;height: 100%;">
        <div id="dtaContener">

            <div id="consolback" style="width: 100%;height: 40px;background-color: crimson;font-size: 20px;text-align: center;line-height: 30px;"> <span style="font-size: 24px; color: white;margin-left: -10px; position: relative;right: 120px;"> < </span>收益</div>
            <br>
            <br>



            <div id="mainContainer">
                <table class="mui-table-view" >
                    <thead>
                    <tr>
                        <th style="width: 20%;border: antiquewhite 1px solid;">商户ID</th>
                        <th style="width: 25%;border: antiquewhite 1px solid;">商户名称</th>
                        <th style="width: 15%;border: antiquewhite 1px solid;">状态</th>
                        <th style="width: 25%;border: antiquewhite 1px solid;">商户地址</th>
                        <th style="width: 15%;border: antiquewhite 1px solid;">查看</th>
                    </tr>
                    </thead>
                    <tbody id="conter">

                    </tbody>
                </table>
            </div>
        </div>
    </div>
<script th:src="@{/js/jquery-1.8.2.min.js}"></script>
<script th:src="@{/js/toast_367A9.js}"></script>
<script type="application/javascript">

            $("#consolback").click(function () {
                history.back(-1);
            });


            $(document).on("click",'#store ',function(){

                        var userid=$(this).attr("userid");
                        console.log(userid);
                        var json={parentid:userid};
                        var demp=0;
                        var num=0;
                        var price=0;
                        $.ajax({
                            url: "/store/getSorePrice",
                            dataType:'json',
                            contentType:"application/json",
                            data:json,
                            success:function (data) {

                                if (data.status==200){
                                    var datas=data.data;
                                    num=datas.length;
                                    for (var i=0;i<num;i++){
                                        if (datas[i].groupid!=1){
                                            demp++;
                                            price+=30;
                                        }
                                    }

                                mui.confirm(
                                    "对方会员数"+num+'\n'+"充值会员数"+demp+'\n'+"带给您的收益为"+price, '提示',['确定'],null
                                )
                              }else {
                                    mui.confirm(
                                       "对方还没有会员", '提示',['确定'],null
                                    )
                                 }

                            },
                            error : function(req, err, ex) {
                                $("#txtRep").val(req.responseText + "\r\n" + err + "\r\n" + ex);
                            }


                        })

            })




</script>
</body>
</html>